/*
 * @Descripttion: 
 * @version: 
 * @Author: congsir
 * @Date: 2022-07-20 13:26:37
 * @LastEditors: 
 * @LastEditTime: 2022-07-20 14:12:58
 */

import { _decorator, Component, Node, PhysicsSystem, Collider } from 'cc';
const { ccclass, property } = _decorator;

enum PhyGroup {
    CubeA = 1 << 0,
    CubeB = 1 << 1,
}

@ccclass('TestControl')
export class TestControl extends Component {

    @property(Collider)
    public CubeA: Collider = null;


    @property(Collider)
    public CubeB: Collider = null;


    start() {
        PhysicsSystem.instance.enable = true;
        this.CubeA.setGroup(PhyGroup.CubeA);
        this.CubeA.setMask(PhyGroup.CubeB);


        this.CubeB.setGroup(PhyGroup.CubeB);
        this.CubeB.setMask(PhyGroup.CubeA);
    }

    onLoad() {

    }

    update(deltaTime: number) {
        let pos = this.CubeA.node.position;
        pos.set(pos.x, pos.y, pos.z + 0.1);
        this.CubeA.node.position = pos;
    }
}

